package com.jiazhong.cloud.example.student.course.controller;

import com.jiazhong.cloud.example.student.commons.bean.Course;
import com.jiazhong.cloud.example.student.commons.util.JsonResult;
import com.jiazhong.cloud.example.student.course.service.CourseService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/course")
public class CourseController {
    @Resource
    private CourseService courseService;

    @PostMapping
    public JsonResult save(Course course) {
        return courseService.saveCourse(course);
    }

    @GetMapping("/find_id/{id}")
    public JsonResult findCourseById(@PathVariable("id") String id) {
        log.info("用户访问了这个服务器");
        return courseService.findCourseById(id);
    }
}
